local t = require('utils.table')
local m = require('utils.vim')
local w = require('utils.win')
local fm = require('utils.file')

local pick_cmds = function()
   w.close_current_floating_window()

   local fn = vim.fn.stdpath("config") .. "/../cmd.json"
   if not fm.file_exists(fn) then
       require('notify')(fn .. ' NOT EXISTS!')
       return
   end
   local files = fm.read_json_file(fn)
   local paths = t.map(files,function(el)
       return el.name
   end)
   require('helper.selector_cmd').quick_select(paths)
end

m.map({"n","x"},"<M-m>",pick_cmds,{desc="Pick and run commands"})

-- EOP
